function Param(){
    this.date = new Array();
    this.data = new Array();
    this.uData = new Array();
    this.dData = new Array();
    this.lData = new Array();
}

 var param = new Param();

function formakData(result) {
    var markets = (result.data.timeSeries)["150197"];
    for (var key in markets) {
            param.date.push(formakDate(key));
            var value = [markets[key].openingPrice,markets[key].closingPrice,markets[key].lowestPrice,markets[key].highestPrice];
            param.data.push(value);
            if(markets[key].openingPrice > markets[key].closingPrice){
                param.uData.push(markets[key].turnoverVal);
                param.dData.push("-");
            }else{
                param.dData.push(markets[key].turnoverVal);
                param.uData.push("-");
            }
            param.lData.push(markets[key].lowestPrice*1.2);

    }
}

function formakDate(key){
    var date = new Date(key.replace("CST",""));
    return date.getFullYear()+"/"+date.getMonth()+"/"+(date.getDay()+1)
}




var myChart = echarts.init(document.getElementById('map'));
myChart.showLoading();

$.getJSON("js/day/data_day.json",function(result){
    formakData(result);
    param.date = param.date.reverse();
    param.data = param.data.reverse();
    param.uData = param.uData.reverse();
    param.dData = param.dData.reverse();
    myChart.setOption(loadOption(param));
    myChart.hideLoading();
});


